import time


def full_func_timer(detail: bool=False, multiline: bool=False):
    def wrapper(func):
        def inner(*args, **kwargs):
            t = time.perf_counter()
            ans = func(*args, **kwargs)
            t = time.perf_counter() - t
            if detail:
                args_list = [f"{a}={b}" for a, b in zip(func.__code__.co_varnames, [*args] + list(func.__defaults__[len(args) - func.__code__.co_argcount:]))] \
                            + [f"{a}={b}" for a, b in kwargs.items()]
                if multiline:
                    p2a = ', '.join(args_list)
                else:
                    p2a = ((',\n' + (len(func.__name__) + 1) * ' ')).join(args_list)
            else:
                p2a = ""
            print(f"{func.__name__}({p2a}) 的运行时间为 {t} s")
            return ans
        return inner
    return wrapper


if __name__ == "__main__":
    @full_func_timer(detail=True)
    def some_func(num=2):
        time.sleep(num)

    some_func()